import {COLL_ADD, COLL_MINUS} from '../constants'
//5-3 封装创建 action 对象的函数
export function addAction(data){
    return {
        type: COLL_ADD,
        data
    }
}

export function minusAction(data){
    return {
        type: COLL_MINUS,
        data
    }
}

//5-4 异步修改状态
export function asyncAddAction(data){
    return dispatch => {
        //定时器
        setTimeout(() => {
            dispatch(addAction(data));
        }, 1000)
    }
}